<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>{{block 'title'}}{{/block}}</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="/css/bootstrap.min.css">
    <style>
        .nav-container{
            display: flex;
            width: 100%;
            justify-content: space-between;
        }
        .custom-nav{
            align-items: center;
        }
        #navbarSupportedContent{
            width: 100%;
        }
        .custom-nav li{
            margin: 0 10px;
        }
        .custom-nav li a{
            color: #555555;
        }
        .active a{
            color: #007bff!important;
        }
        li.nav-item .rounded-circle{
            object-fit: cover;
            border-radius: 50%;
        }
        .navbar{
            padding: 0;
            margin-bottom: 20px;
        }
        li.nav-item {
            line-height: 50px;
        }
    </style>
    {{block 'style'}}{{/block}}
</head>
<body>
<div style="width: 100%;">
    <nav class="navbar navbar-default" style="background-color: #e3f2fd;">
        <div class="container">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand" href="/">我的博客</a>
            </div>

            <!-- Collect the nav links, forms, and other content for toggling -->
            <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                <ul class="nav navbar-nav">
                    <li class="{{block 'home-active'}}{{/block}}"><a href="/">首页</a></li>
                    <li class="{{block 'blog-list-active'}}{{/block}}"><a href="/blog/list">文章列表</a></li>
                </ul>
                <ul class="nav navbar-nav navbar-right" style="margin-left: 20px">
                    {{if session.user}}
                    <li class="nav-item">
                        <img src="{{session.user.avatar}}" alt="..." class="rounded-circle" width="40px" height="40px">
                    </li>
                    <li class="nav-item dropdown">
                        <a class="nav-link dropdown-toggle" href="javascript:;" id="navbarDropdown" role="button"
                           data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                            {{session.user.username}}
                        </a>
                        <ul class="dropdown-menu" aria-labelledby="navbarDropdown">
                            <li><a href="/user/center">个人资料</a></li>
                            <li><a class="dropdown-item" href="/user/blog">文章管理</a></li>
                            <li><a class="dropdown-item" href="/user/setting">设置</a></li>
                            <li><a class="dropdown-item" href="/user/logout">退出</a></li>
                        </ul>
                    </li>
                    {{else}}
                    <li class="nav-item">
                        <a class="nav-link" href="/user/login">登录 <span class="sr-only">(current)</span></a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="/user/register">注册</a>
                    </li>
                    {{/if}}
                </ul>
                <form class="navbar-form navbar-right" method="get" action="/blog/list" id="searchForm">
                    <div class="form-group">
                        <input type="text" class="form-control" placeholder="请输入搜索内容" name="search">
                    </div>
                    <button type="submit" class="btn btn-default">搜索</button>
                </form>
            </div>
        </div>
    </nav>
</div>
{{block 'content'}}{{/block}}
<script src="/js/jquery.min.js"></script>
<script src="/js/coco-message.min.js"></script>
<script type="text/javascript" src="/js/bootstrap.min.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/dayjs/1.11.3/dayjs.min.js"></script>
{{block 'js'}}{{/block}}
</body>
</html>
